fix(runner): cap HuggingFace Retry-After backoff at 30s - #50
Conversation
Honor Retry-After integer seconds and HTTP-date values only up to the existing 30s quadratic fallback ceiling. A 429 with Retry-After: 3600 could block clawscan benchmark for an hour per attempt when the client context is Background. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed September 1, 2026, 2:13 PM ET / 18:13 UTC. ClawSweeper reviewWhat this changesThe PR limits numeric and HTTP-date Hugging Face Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 5 items remain Keep this PR open: its 30-second cap is a focused availability improvement, but numeric Priority: P1 Review scores
Verification
How this fits togetherClawScan’s benchmark runner fetches dataset rows from Hugging Face and retries transient HTTP failures. The computed retry delay controls when the benchmark client sends its next row request. flowchart LR
A[Benchmark command] --> B[Hugging Face row client]
B --> C[HTTP response]
C --> D{Retriable status}
D -->|429 or 5xx| E[Retry delay policy]
E --> B
D -->|Success| F[Benchmark rows]
Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Clamp numeric seconds to the 30-second maximum before converting to Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: on a 64-bit build, a numeric header such as Is this the best way to solve the issue? No: the HTTP-date cap is at the right boundary, but numeric seconds must be bounded before duration conversion so the cap applies to every parseable non-negative value. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6432c40f2340. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (14 earlier review cycles; latest 8 shown)
|
What Problem This Solves
clawscan benchmark clawhub-security-signalsfetches HuggingFace dataset rows and retries on 429/5xx.huggingFaceRowsBackoffhonorsRetry-Afteras integer seconds or an HTTP-date with no ceiling, while the quadratic fallback is already capped at 30s.The public CLI builds
HuggingFaceBenchmarkClientwith a nil Context, sorequestContext()iscontext.Background()and the retryselectnever expires. A 429 withRetry-After: 3600blocks the process for one hour per attempt (up to five waits). This change capsRetry-Afterat the same 30s ceiling. It does not add a process-wide signal context.The uncapped header path was introduced in #3 (2026-06-25). #46 made the wait cancelable when a context is set; it did not cap the delay.
Evidence
Red (unfixed
huggingFaceRowsBackoff):Green (after the 30s cap):
Retry-After: 3600and an HTTP-date two hours ahead both return 30s. The quadratic fallback path is unchanged.Real behavior proof
Behavior or issue addressed: HuggingFace row-fetch
Retry-Afterdelays (integer seconds and HTTP-date) are capped at 30s, matching the existing fallback ceiling, so a 429 cannot stallclawscan benchmarkfor an hour per attempt.Real environment tested: macOS 26.6.2 (Darwin 25.6.0 arm64), go1.27.0 darwin/arm64, checkout
/tmp/oc-pr-clawscan-F003onfix/f003-huggingface-retry-after-cap.Exact steps or command run after this patch:
go test -count=1 -timeout 30s -v -run TestHuggingFaceRowsBackoffCapsRetryAfter ./internal/runner/Evidence after fix: terminal output from the patched tree:
Observed result after fix:
Retry-After: 3600is 30s (was 1h). An HTTP-date two hours ahead is also 30s. The helper no longer returns a multi-hour wait.What was not tested: A live HuggingFace 429 with a long
Retry-Afterheader. Network fetch ofdatasets-server.huggingface.coduring this change.Command:
go test -count=1 -timeout 30s -v -run TestHuggingFaceRowsBackoffCapsRetryAfter ./internal/runner/Observed: unfixed delay was
1h0m0sforRetry-After: 3600; patched delay is30sfor both3600and a future HTTP-date.Expected: both header forms cap at 30s.
Time: 11:07:34 PDT (2026-08-29 18:07:34 UTC)
Date: 2026-08-29
Environment: macOS 26.6.2, Darwin 25.6.0 arm64, go1.27.0 darwin/arm64